﻿using System;
using System.Collections.Generic;
using System.Text;
using Ghasam.Business.DAO;
using Ghasam.Business.Domain.Entity;
using Spring.Transaction.Interceptor;

namespace Ghasam.Business.Services.Impl {
    public class EmployeeLeaveService : IEmployeeLeaveService {

        public IEmployeeLeaveDao EmployeeLeaveDao { get; set; }

        #region IEmployeeLeaveService Members

        [Transaction(ReadOnly = false)]
        public void Delete(EmployeeLeave employeeLeave) {
            EmployeeLeaveDao.Delete(employeeLeave);
        }

        [Transaction(ReadOnly = false)]
        public void SaveOrUpdate(EmployeeLeave employeeLeave) {
            EmployeeLeaveDao.SaveOrUpdate(employeeLeave);
        }

        public IList<EmployeeLeave> GetEmployeeLeaves(Employee employee, DateTime startDate, DateTime endDate, int pageSize, int pageNumber) {
            return EmployeeLeaveDao.FindEmployeeLeaves(employee, startDate, endDate, pageSize, pageNumber);
        }

        public int CountEmployeeLeaves(Employee employee, DateTime startDate, DateTime endDate) {
            return EmployeeLeaveDao.CountEmployeeLeaves(employee, startDate, endDate);
        }

        public EmployeeLeave GetEmployeeLeave(int Id) {
            return EmployeeLeaveDao.FindById(Id);
        }

        #endregion
    }
}
